package com.zjj.controller;

import com.zjj.entity.User;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("users")
public class UserRestController {

    //新增 post
    @PostMapping
    public String saveUser(@RequestBody User user){

        return "新增用户";
    }

    //修改
    @PutMapping
    public String updateUser(@RequestBody User user){

        return "修改用户";
    }

    //删除
    @DeleteMapping("/{userId}")
    public String delUser(@PathVariable Integer userId ){
        System.out.println(userId);
        return "删除用户";
    }

    //获取全部信息
    @GetMapping
    public List<User> getList(){
        System.out.println("获取全部数据结果集");
        return null;
    }

    //获取单个
    @GetMapping("/{id}")
    public User getUserInfo(@PathVariable("id") Integer userId){
        System.out.println("返回单个用户信息");
        return null;
    }
}
